package strategy.view 
{
	import flash.display.Shape;
	import flash.display.Sprite;
	import flash.events.MouseEvent;
	import org.airmvc.Dispatcher;
	import strategy.StrategyC;
	import utils.T;
	import vo.PlayerVO;
	
	/**
	 * ...
	 * @author WLDragon 2014-03-15
	 */
	public class Castle extends Sprite 
	{
		
		public function Castle(id:int) 
		{
			this.id = id;
			buttonMode = true;
			tabEnabled = false;
			
			//透明底板，点击用
			with (graphics)
			{
				beginFill(0x000000,0);
				drawRect(-2, -2, 18, 14);
				endFill();
			}
			
			shape = new Shape();
			addChild(shape);
		}
		
		public function update(playerId:int):void
		{
			if (playerId == 0)
			{
				//空城
				with (shape.graphics)
				{
					beginFill(0xFFFFFF);
					drawRect(4, 0, 8, 4);
					drawRect(0, 4, 16, 8);
					endFill();
				}
			}
			else
			{
				var p:PlayerVO = T.db.getRecord(Cnt.VO_PLAYER, playerId) as PlayerVO;
				with (shape.graphics)
				{
					beginFill(p.color2);
					drawRect(4, 0, 8, 4);
					drawRect(0, 4, 16, 8);
					endFill();
					beginFill(p.color);
					drawRect(6, 2, 4, 4);
					drawRect(2, 6, 12, 4);
					endFill();
				}
			}
			
		}
		
		public var id:int;
		private var shape:Shape;
	}

}